<template>
	<el-container>
		<el-header style="height: auto;">
			<sc-select-filter :data="filterData" :label-width="80" @on-change="filterChange"></sc-select-filter>
		</el-header>
		<el-header>
			<div class="left-panel">
			</div>
			<div class="right-panel">
				<div class="right-panel-search">
					<el-input v-model="search.keyword" placeholder="标题 / 摘要"></el-input>
					<el-button type="primary" icon="el-icon-search" @click="upsearch"></el-button>
				</div>
			</div>
		</el-header>
		<el-main class="nopadding">
			<scTable ref="table" :apiObj="apiObj" row-key="recordId" stripe remoteSort remoteFilter>
				<el-table-column label="#" type="index" width="50"></el-table-column>
				<el-table-column label="招标标题" prop="title" width="200" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="项目编号" prop="codeNo" width="150" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="投标企业" prop="entName" width="150" :show-overflow-tooltip="true"></el-table-column>
				<el-table-column label="投标时间" prop="revTime" width="150"></el-table-column>
				<el-table-column label="投标文件" prop="attachId" width="200" :show-overflow-tooltip="true">
					<template #default="scope">
						<attach-menu :attachIds="scope.row.attachId" :roleFlag="3" :preview="true"></attach-menu>
					</template>
				</el-table-column>
				<el-table-column label="当前状态" prop="status" width="100">
					<template #default="scope">
						<el-tag v-if="scope.row.status=='0'" type="success" effect="dark">投标中</el-tag>
						<el-tag v-else-if="scope.row.status=='1'" type="primary" effect="dark">已开标</el-tag>
						<el-tag v-else type="info" effect="dark">未知</el-tag>
					</template>
				</el-table-column>
				<el-table-column label="联系人" prop="linkMan" width="100"></el-table-column>
				<el-table-column label="联系电话" prop="tel" width="100"></el-table-column>
				<el-table-column label="电子邮件" prop="email" width="100"></el-table-column>
				<el-table-column label="创建时间" prop="createTime" width="150"></el-table-column>
				<el-table-column label="操作" fixed="right" align="right" width="170">
					<template #default="scope">
						<el-button-group>
							<el-button text type="primary" size="small" @click="table_show(scope.row, scope.$index)">查看</el-button>
							<el-button text type="primary" size="small" @click="table_edit(scope.row, scope.$index)" v-if="scope.row.status=='0'">评标</el-button>
						</el-button-group>
					</template>
				</el-table-column>
			</scTable>
		</el-main>
	</el-container>
	<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog>
	<recordDetails v-if="dialog.detailsSave" ref="detailsDialog" @closed="dialog.detailsSave=false"></recordDetails>
</template>

<script>
import scSelectFilter from '@/components/scSelectFilter'
import recordDetails from '@/views/invite/bidding/details'
import saveDialog from './save'
import AttachMenu from "@/views/module/attachMenu.vue";
export default {
	name: 'Invite Manage',
	components: {
		AttachMenu,
		saveDialog,
		scSelectFilter,
		recordDetails
	},
	data() {
		return {
			dialog: {
				save: false,
				detailsSave:false
			},
			filterData: [
				{
					title: "日期范围",
					key: "date",
					multiple: false,
					options: [
						{
							label: "全部",
							value: ""
						},
						{
							label: "今日",
							value: "1"
						},
						{
							label: "昨日",
							value: "2"
						},
						{
							label: "一周内",
							value: "3"
						},
						{
							label: "一月内",
							value: "4"
						},
						{
							label: "一月前",
							value: "5"
						}
					]
				}
			],
			apiObj: this.$API.invite.inviteBidding.getInviteBiddingManageList,
			search: {
				date:'',
				status:'',
				keyword: null
			}
		}
	},
	mounted() {
	},
	methods: {
		//编辑
		table_edit(row) {
			this.dialog.save = true
			this.$nextTick(() => {
				this.$refs.saveDialog.open().setData(row)
			})
		},
		//查看
		table_show(row) {
			this.dialog.detailsSave = true
			this.$nextTick(() => {
				this.$refs.detailsDialog.open("setting").setData(row)
			})
		},
		//搜索
		async upsearch() {
			this.$refs.table.upData(this.search)
		},
		filterChange(data){
			this.search.date = data.date;
			this.search.status = data.status;
			this.$refs.table.upData(this.search)
		},
		//本地更新数据
		handleSaveSuccess() {
			this.$refs.table.refresh()
		}
	}
}
</script>

<style>
</style>
